package src.shiyan;

import java.io.*;
import java.util.Scanner;

public class digui
{
    public static void main(String[] args) throws IOException {
        Scanner scan =new Scanner(System.in);
        System.out.println("输入一个数n(n>=0):");

        int n;
        n =scan.nextInt();

        int result = hanshu(n);
        System.out.println("f(n)的值是" + result);

        File file = new File("D:\\新建文件夹","niubi.text");
//        File file1 = new File("niubi.text");
        if(!file.exists())
            file.createNewFile();
//        file1.createNewFile();
        FileWriter writer = new FileWriter(file);
//        OutputStream outputStream1 =new FileOutputStream(file1);
        writer.write("结果是" + result);
        writer.flush();



    }
    static int hanshu(int n)
    {

            if(n==0)
            return 0;
            else
                 if (n==1)
                 return 1;
                 else
                 return hanshu(n-1) +hanshu(n-2);
    }




}
